Methods for obtaining a three-band intrinsic image from a single input image

ABSTRACT

Various embodiments of the present invention related to methods for obtaining shadow invariant and shadow-shading invariant images from a single camera image taken with a narrow-band camera sensor and assuming Plankian illuminating conditions.

TECHNICAL FIELD

Various embodiments of the present invention relate to methods for decomposing a single input image into intrinsic images.

BACKGROUND

Illumination conditions cause problems for many computer vision algorithms. In particular, variations in color or intensity of the illumination of a scene captured by a camera can cause problems for algorithms that segment, track, or recognize objects in a captured input image of the scene. For example, consider an input image of a box 102 disposed on a surface of grid lines 104 shown in FIG. 1A. The input image can be a digital image captured by a camera. Because the box 102 is illuminated from one direction, the shading on the box 102 opposite the illuminating direction is nearly indistinguishable from the shadow cast by the box 102 on the surface 104. The dark surface region of the box 102 and the shadow cast by the box 102 onto the surface 104 make the tasks of identifying the box 102 a challenge for image recognition algorithms or segmenting the image of the box 102 from the image of the surface 104 a challenge for many segmentation algorithms.

In order to alleviate the difficulties of image segmenting, recognition, or object tracking, a input image can be ideally decomposed into two intrinsic images called an illumination image and a shadow invariant image. FIGS. 1B and 1C show a decomposition of the input image shown in FIG. 1A into a shadow invariant image and an illumination image, respectively. The shadow invariant image shows the box 102 and the surface 104 with the shadow observed in FIG. 1A removed. In other words, a shadow invariant image is independent of the illumination conditions. On the other hand, the illumination image shows only the shadows cast by the box 102 created by illuminating the box from one direction. Decomposing an image into the intrinsic images can be useful for supporting a range of visual inferences. For example, a typical segmentation algorithm would likely correctly segment the box 102 as a single segment using the shadow invariant image shown in FIG. 1B.

In recent years, a number of different techniques have been developed for decomposing a input image into intrinsic images and in particular to obtaining the shadow invariant image of a input image. Certain techniques derive a shadow invariant image of a scene from a sequence of images of the scene under a range of illumination conditions. However, obtaining multiple images of a scene under various illumination conditions can be time intensive and is not always practical. Other techniques use a single input image but require human interaction or user assisted methods to perform reflection and shadow separation. These methods can produce good results with careful user assistance, but are time and labor intensive. Other techniques that use a single image but without user assistance are learning based approaches that separate reflectance edges and illumination edges in a derivative image. Although these methods can separate reflectance and shading for a given illumination direction, these methods have difficulty classifying edges under arbitrary lighting conditions. In still other techniques, by assuming a Lambertian surface and using a three-band camera sensor (i.e., red, green, and blue bands), a one-dimensional grayscale image that is invariant to shadow and shading can be obtained. However, these techniques transform a red, green, and blue (“RGB”) based image into a one-dimensional grayscale representation which reduces the distinction between surfaces. These techniques have been extended to derive a two-dimensional image using a four-band camera, which eliminates the Lambertian assumption, and theoretically has been proven to generate three-dimensional invariant images that can be recovered with six-band cameras. However, four- and six-band cameras are rarely ever used.

Thus, recovering color shadow invariant images from a single input image of a three-band camera remains a challenging problem for computer vision systems.

BRIEF DESCRIPTION OF THE DRAWINGS

The patent or application file contains at least one drawing executed in color. Copies of this patent or patent application publication with color drawing(s) will be provided by the Office upon request and payment of the necessary fee.

FIGS. 1A-1C show decomposition of an image into two intrinsic images.

FIG. 2A shows a plot of a spectral power distribution in accordance with embodiments of the present invention.

FIG. 2B shows a plot of a surface reflectance spectrum of an object in accordance with embodiments of the present invention.

FIG. 2C shows a plot of the product of the spectral power distribution and the surface reflectance spectrum shown in FIGS. 2A and 2B, respectively, in accordance with embodiments of the present invention.

FIG. 3 shows a conceptual representation of red, green and blue intensities of 16 pixels of a digital input image in accordance with embodiments of the present invention.

FIG. 4 shows an example of a digital camera electronically coupled to a desktop computer in accordance with embodiments of the present invention.

FIG. 5 shows a schematic representation of a computing device configured in accordance with embodiments of the present invention.

FIG. 6A shows shadow and non-shadow pixels associated with a portion of an input image in accordance with embodiments of the present invention.

FIG. 6B shows an exemplary plot of red, green, and blue relative wavelength distributions obtained in accordance with embodiments of the present invention.

FIGS. 7A-7B show portions of an input image used to calibrate an image recording device in accordance with embodiments of the present invention.

FIG. 8 shows a control-flow diagram of a method for generating a shadow invariant image from an input image in accordance with embodiments of the present invention.

FIGS. 9A-9C show shadow invariant and shadow-shading invariant images obtained in accordance with embodiments of the present invention.

DETAILED DESCRIPTION

Various embodiments of the present invention are directed to methods for determining a shadow invariant, three-dimensional color intrinsic image from a single RGB image and obtaining a shadow-shading invariant, two-dimensional image from a single RGB image. In the following description of method embodiments, a linear relationship between the color of a shadow invariant image and the color of the RGB input image are derived and extended for shading reduction.

I. Illumination and Reflection Model

Methods of present invention assume that a spectral power distribution (“SPD”) provides an adequate representation of an illumination spectrum of a scene and follows Plank's law:

${E\left( {\lambda,T} \right)} = {\frac{2\pi\;{hc}^{2}}{\lambda^{5}}\frac{1}{{\exp\left( \frac{hc}{\lambda\;{kT}} \right)} - 1}}$ where

h is Plank's constant;

c is the speed of light in a vacuum;

k is Boltzmann's constant;

T is the color temperature; and

λ is the wavelength of light.

The SPD provides an approximation of the basic physical information about the light illuminating the scene and serves as a starting point for quantitative analyses of color. For example, the SPD can approximate the spectrum of sun light striking surfaces of objects in a scene or approximate the spectrum of light emanating from one or more incandescent light sources. For illuminations in the temperature range of about 2500 K to about 10000 K (reddish through whitish to bluish), the term:

${\exp\left( \frac{hc}{\lambda\;{kT}} \right)}{\bullet 1}$ and Wien's approximation can be used to obtain an approximation to the SPD given by:

${E\left( {\lambda,T} \right)} = {\frac{2\pi\;{hc}^{2}}{\lambda^{5}}{\exp\left( {- \frac{hc}{\lambda\;{kT}}} \right)}}$ FIG. 2A shows a plot of an SPD E(λ,T) over the visible spectrum of wavelengths for a particular temperature T. In FIG. 2A, axis 202 corresponds to the visible range of wavelengths, axis 204 corresponds to optical power, and curve 206 represents an SPD E(λ,T) of the visible spectrum at the temperature T.

For the surface reflection model of a scene captured as an input image, methods of the present invention employ a dichromatic model for describing the reflected light. The dichromatic model is based on the assumption that the light reflected from an object is a combination of diffuse light and specular light. In other words, the intensity of each pixel of a input image is treated independently, in the same manner, and is represented by the pixel intensity equation: I=I _(Diff) +I _(Spec) where

I_(Diff)=ρ_(d)∫_(λ)E(λ,T)S(λ)Q(λ)dλ is the intensity associated with the diffusion portion of the pixel intensity;

I_(Spec)=ρ_(s)∫_(λ)E(λ,T)Q(λ)dλ is the intensity associated with the specular portion of the pixel intensity;

ρ_(d) and ρ_(s) are geometric factors associated with diffuse and specular reflection of each pixel;

S(λ) is a surface reflectance spectrum (“SRS”); and

Q(λ) is a sensor element response.

Because the geometry of a scene can vary from pixel to pixel, the values of ρ_(d) and ρ_(s) can vary from pixel to pixel. The SRS S(λ) represents reflectance of light from an object over a range of wavelengths. FIG. 2B represents an example of an SRS of an object in accordance with embodiments of the present invention. In FIG. 2B, axis 208 represents reflectance and curve 210 is an exemplary representation of an SRS S(λ) for an object reflecting light primarily in the red wavelength portion of the visible spectrum.

The reflectance of an object is influenced by the range of illuminating wavelengths. For example, the color spectrum of light reflected from an object illuminated under interior lighting appears different than the color spectrum of light reflected from the same object illuminated under sun light, and the SPD associated with interior light is different from the SPD associated with sun light. The reflectance of the object illuminated under the light conditions characterized by the SPD E(λ,T) 206 and having the surface reflectance spectrum SRS S(λ) 210 is characterized by the product E(λ,T)S(λ) and is represented by curve 212 shown in FIG. 2C.

The image recording device includes a sensor composed of an image sensor overlaid with a color filter array (“CFA”), such as Bayer filter. The image sensor comprises an array of neighboring sensor elements and the light reaching each sensor element passes through a red, green, or blue color filter of the CFA. The CFA may comprise alternating red and green filters for odd rows and alternating green and blue filters for even rows, with twice as many green filters as red or blue filters. The wavelengths λ_(r), λ_(g), and λ_(b) represent the red, green, and blue wavelengths or RGB bands detected by sensor elements of the sensor and are the primary colors used to reconstruct pixels of a single digital input image of a scene captured by the image recording device. In other embodiments, other color models can be used requiring three or more color values per pixel, such as yellow, cyan, and magenta. A single sensor element cannot simultaneously record these three intensities. Thus, the CFA can be used to selectively filter a particular color for each pixel.

For an RGB image recording device, Q(λ) denotes the response of a sensor element associated with each of RGB bands. Mathematically, a sensor element response can be characterized by: Q _(u)(λ)=q _(u)δ(λ−λ_(u)) where

u∈{r,g,b};

q_(u) is the magnitude of the sensor response associated with the pixel; and

δ(λ−λ_(u)) is the Dirac delta function.

The sensor response Q(λ) associated with each wavelength can be a voltage created by light of one of the three bands reaching a particular sensor element. The magnitude of a sensor element response q_(u) corresponds to the intensity of the wavelength of light reaching a sensor element and is used to estimate the color level for a corresponding pixel of the input image. An example of a sensor response Q(λ) is represented in FIGS. 2A and 2C by lines 214 and 216 for a particular wavelength λ_(k).

A demosaicing algorithm can be used to interpolate color information into a full color image image data based on the raw voltage data obtained from the image sensor. Demosaicing is part of the processing pipeline that renders the raw image data into a viewable format and is well-known in the art. The result of demosaicing is a full color digital input image comprising pixels. Each pixel is the smallest unit of information in an image, and each pixel typically comprises three primary color bands, such as red, green, and blue of varying intensity. By varying the intensity the three colors red, green, blue, each pixel is capable of displaying a full range of colors. Demosaicing can be implemented in firmware in the image recording device or in software in a raw converter program that converts the raw voltage data obtained from the image sensor into RGB color values associated with each pixel of the full color image.

Integrating the diffuse and specular intensity terms of the pixel intensity for a particular RGB band u gives: I _(u)=ρ_(d) E(λ_(u) ,T)S(λ_(u))q _(u)+ρ_(s) E(λ_(u) ,T)q _(u) Substituting the Wien approximation for the SPD gives:

$I_{u} = {\left( {{\rho_{d}{S\left( \lambda_{u} \right)}} + \rho_{s}} \right)q_{u}\frac{2{hc}^{2}}{\lambda_{u}^{5}}{\exp\left( {- \frac{hc}{\lambda_{u}{kT}}} \right)}}$ In other words, I_(u) represents the pixel intensity of the RGB band u.

The intensities I_(r), I_(g), and I_(b) for each pixel can be individually varied to create an array of colors for each pixel. FIG. 3 shows a conceptual representation of RGB intensities I_(r), I_(g), and I_(b) associated with a 4×4 grid of 16 pixels of a digital input image in accordance with embodiments of the present invention. Each pixel is represented by a cuboid and the height of each pixel above the xy-plane corresponds to a level of the intensity I_(u). For example, a color exhibited by one of the 16 pixels comprises a red pixel intensity component 302, a green pixel intensity component 304, and a blue pixel intensity component 306. A combination of intensities displayed simultaneously produces a pixel of a particular color.

The color associated with a pixel can be stored in a memory device as an RGB triplet (r,g,b), where each color band can vary from zero to a defined maximum value. When all the bands are at zero the resulting color of the pixel is black. By contrast, when all of the bands of a pixel are at the maximum value, each of the RGB bands of the pixel is at full intensity and the resulting color of the pixel is the brightest representable white.

The ranges for each band may be quantified in several different ways and stored as a numerical value. For example, a color band can range from “0” to “1,” with “0” corresponding to no color represented, “1” corresponding to the full color band intensity, and any fractional value in between. This reprentation can be used in systems that use floating-point representations for color band intensities. In computing, 256 intensities associated with each color band can be stored as an integer ranging from “0” to “255,” which is the range offered by a single 8-bit byte. For example, the RGB triplets (255,0,255) and (255,255,0) represent magenta and yellow pixels, respectively. For relatively higher-end digital imaging systems, the integer range 0 to 65,535 can be used for each color band, which is the range a single 16-bit word can represent.

II. Computing Device

The image recording device can be, but is not limited to, a digital camera, a mobile phone or camera phone, a personal digital assistant, a camcorder or any device that digitally captures images via an electronic image sensor and can store the image data in memory, such as flash memory or any other storage medium. The image recording device can include a video output port or a wireless medium enabling the image recording device to establish communication with a computing device so that digital images stored in memory of the image recording device can be uploaded to the computing device for image processing as described below in subsections III-VI. The computing device can be any device that allows a user to receive digital images uploaded from the image recording device and is capable of presenting a user interface on a display screen, including, but not limited to: a desktop computer, a laptop computer, a portable computer, a display system, a television, a computer monitor, a navigation system, a portable media player, a personal digital assistant, a game console, a handheld electronic device, an embedded electronic device, or an appliance.

FIG. 4 shows an example of a digital camera 402 electronically coupled to a desktop computer 404 in accordance with embodiments of the present invention. The desktop computer 404 and the camera 402 can include applications that enable digital images stored in the camera 402 memory to be uploaded to the desktop computer 404 for image processing.

FIG. 5 shows a schematic representation of a computing device 500 configured in accordance with embodiments of the present invention. The system 500 includes one or more processors 502, such as a central processing unit; one or more display devices 504, such as a monitor; a camera interface 506; one or more network interfaces 508, such as a USB port, an Ethernet, or FireWire port; one or more computer-readable mediums 510. Each of these components is operatively coupled to one or more buses 512. For example, the bus 512 can be an EISA, a PCI, a USB, a FireWire, a NuBus, or a PDS.

The computer readable medium 510 can be any medium that participates in providing instructions to the processor 502 for execution and storage of image data. For example, the computer readable medium 510 can be non-volatile media, such as an optical or a magnetic disk; volatile media, such as memory; and transmission media, such as coaxial cables, copper wire, and fiber optics. Transmission media can also take the form of acoustic, light, or radio frequency waves.

The computer-readable medium 510 also includes an operating system 514, such as Mac OS, Windows, Unix, and Linux; a network communications module 516; and an intrinsic image application 518. The operating system 514 can be multi-user, multiprocessing, multitasking, multithreading, real-time and the like. The operating system 514 can also perform basic tasks such as recognizing input from input devices, such as a keyboard or a keypad; sending output to the display 504; keeping track of files and directories on medium 510; controlling peripheral devices, such as disk drives, printers, image recording device 506; and managing traffic on the one or more buses 512. The network applications 516 includes various components for establishing and maintaining network connections, such as software for implementing communication protocols including TCP/IP, HTTP, Ethernet, USB, and FireWire. The computer readable medium 510 can also store other software applications, including word processors, browsers, e-mail, Instant Messaging, and media players.

The intrinsic image application 518 provides various software components for enabling the creation of intrinsic images, as described below in subsections III-VI. In certain embodiments, some or all of the processes performed by the application 518 can be integrated into the operating system 514. In certain embodiments, the processes can be at least partially implemented in digital electronic circuitry, or in computer hardware, firmware, software, or in any combination thereof.

III. Shadow Reduction

The shadow component of the pixel intensity I_(u) is assumed to be characterized by a temperature dependent term. Hence, obtaining an expression for the shadow invariant component reduces to isolating the parameter T. In order to isolate the temperature dependent term of I_(u), the natural logarithm of the pixel intensity I_(u) produces the following expression:

$\begin{matrix} {L_{u} = {{\log\left( I_{u} \right)} = {{\log\left\lbrack {\left( {{\rho_{d}{S\left( \lambda_{u} \right)}} + \rho_{s}} \right)q_{u}\frac{2{hc}^{2}}{\lambda_{u}^{5}}} \right\rbrack} + \left( {- \frac{hc}{\lambda_{u}{kT}}} \right)}}} & {{Equation}\mspace{14mu}(1)} \end{matrix}$ The temperature T is isolated in a term of the right-hand side of L_(u), and the temperature invariant portion of L_(u) is given by the term:

$\begin{matrix} {W_{u} = {\log\left\lbrack {\left( {{\rho_{d}{S\left( \lambda_{u} \right)}} + \rho_{s}} \right)q_{u}\frac{2{hc}^{2}}{\lambda_{u}^{5}}} \right\rbrack}} & {{Equation}\mspace{14mu}(2)} \end{matrix}$ In other words, W_(u) is the shadow invariant term, which can be computed from

$\begin{matrix} {{W_{u} = {L_{u} + \frac{hc}{\lambda_{u}{kT}}}}{Denoting}} & {{Equation}\mspace{14mu}(3)} \\ {{W_{u}^{\prime} = {W_{u}\frac{\lambda_{u}k}{hc}}}{and}} & {{Equation}\mspace{14mu}(4)} \\ {L_{u}^{\prime} = {L_{u}\frac{\lambda\; k}{hc}}} & {{Equation}\mspace{14mu}(5)} \end{matrix}$ gives a second expression for the shadow invariant term as follows:

$\begin{matrix} {W_{u}^{\prime} = {L_{u}^{\prime} + \frac{1}{T}}} & {{Equation}\mspace{14mu}(6)} \end{matrix}$ As described above, the wavelength λ_(u) is a property of the image recording device that is known or can be calibrated as described below in subsection V. Thus, the shadow invariant computation problem is reduced to solving for the parameter T.

W_(u) and W′_(u) both represent a shadow invariant intensity of a pixel for a color band u. The fraction of the color band u present in the shadow invariant image W′_(u) is given by:

$\begin{matrix} {w_{u} = \frac{W_{u}^{\prime}}{\sum\limits_{i \in {\{{r,g,b}\}}}W_{i}^{\prime}}} & {{Equation}\mspace{14mu}(7)} \end{matrix}$ and the fraction of the color band u present in the logarithm image L′_(u) is given by:

$\begin{matrix} {l_{u} = \frac{L_{u}^{\prime}}{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}}} & {{Equation}\mspace{14mu}(8)} \end{matrix}$ Substituting equations (7) and (8) for W′_(u) and L′_(u) in equation (6) gives:

$\begin{matrix} {{w_{u}{\sum\limits_{i \in {\{{r,g,b}\}}}W_{i}^{\prime}}} = {{l_{u}{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}}} + \frac{1}{T}}} & {{Equation}\mspace{14mu}(9)} \end{matrix}$ Summing over every u∈{r,g,b} gives:

$\begin{matrix} {{\sum\limits_{i \in {\{{r,g,b}\}}}W_{i}^{\prime}} = {{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}} + \frac{3}{T}}} & {{Equation}\mspace{14mu}(10)} \end{matrix}$ Substituting equation (10) into equation (9) and solving for T gives:

$\begin{matrix} {T = \frac{1 - {3w_{u}}}{{w_{u}{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}}} - L_{u}^{\prime}}} & {{Equation}\mspace{14mu}(11)} \end{matrix}$ Setting u equal to m, where

$m = {\underset{u \in {\{{r,g,b}\}}}{argmax}L_{u}}$ and substituting equation (11) into equations (6) and (3) gives expressions for the shadow invariant terms as functions of the logarithm image as follows:

$\begin{matrix} {{W_{u}^{\prime} = {L_{u}^{\prime} + \frac{{w_{m}{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}}} - L_{m}^{\prime}}{1 - {3w_{m}}}}}{and}} & {{Equation}\mspace{14mu}(12)} \\ {W_{u} = {L_{u} + {\frac{hc}{\lambda_{u}k}\frac{{w_{m}{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}}} - L_{m}^{\prime}}{1 - {3w_{m}}}}}} & {{Equation}\mspace{14mu}(13)} \end{matrix}$ In general, w_(m) is different for each pixel. However, when w_(m) is set equal to a constant κ, where κ≠⅓, a three-dimensional image that is invariant to shadows can be computed for each pixel as follows:

$\begin{matrix} \begin{matrix} {P_{u} = {L_{u} + {\frac{hc}{\lambda_{u}k}\frac{{\kappa{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}}} - L_{m}^{\prime}}{1 - {3\kappa}}}}} \\ {= {L_{u} + \frac{{\kappa{\sum\limits_{i \in {\{{r,g,b}\}}}{\frac{\lambda_{i}}{\lambda_{u}}L_{i}}}} - {\frac{\lambda_{m}}{\lambda_{u}}L_{m}}}{1 - {3\kappa}}}} \end{matrix} & {{Equation}\mspace{14mu}(14)} \end{matrix}$ P_(u) is the shadow invariant intensity of a color band u associated with a pixel. Each shadow invariant pixel has a triplet of shadow invariant intensities (P_(r), P_(g), P_(b)). Thus, a full color shadow invariant image can be obtained and displayed by computing P_(u) for each band of each pixel of an input image.

The relationship between P_(u) and W_(u) is summarized in Theorems 1 and 2 as follows:

-   Theorem 1: For any two pixels x and y, if W_(u)(x)=W_(u)(y), then     P_(u)(x)=P_(u)(y). -   Theorem 2: For any two pixels x and y, if P_(u)(x)=P_(u)(y), then     W_(u)(x)=W_(u)(y) or the color difference of W_(u)(x) and W_(u)(y)     is neutral. In other words,

$\frac{{W_{u}(x)} - {W_{u}(y)}}{\sum\limits_{i \in {\{{r,g,b}\}}}\left( {{W_{i}(x)} - {W_{i}(y)}} \right)} = \frac{1}{3}$ Proofs of Theorems 1 and 2 are provided in an APPENDIX.

IV. Shading Reduction

The method of subsection III can be further extended to remove both shadow and shading from a digital input image. From equations (10), (11), and (12), each pixel of a two-dimensional intrinsic image that is invariant to shadows and shading is computed by:

$\begin{matrix} \begin{matrix} {w_{u} = \frac{L_{u}^{\prime} + \frac{{w_{m}{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}}} - L_{m}^{\prime}}{1 - {3w_{m}}}}{{\sum\limits_{i \in {\{{r,g,b}\}}}L_{u}^{\prime}} + {3\frac{{w_{m}{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}}} - L_{m}^{\prime}}{1 - {3w_{m}}}}}} \\ {= \frac{L_{u}^{\prime} - L_{m}^{\prime} + {w_{m}\left( {{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}} - {3L_{u}^{\prime}}} \right)}}{{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}} - {3L_{m}^{\prime}}}} \end{matrix} & {{Equation}\mspace{14mu}(15)} \end{matrix}$ Again, substituting the constant κ for w_(m), transforms equation (14) into a shadow-shading invariant image:

$\begin{matrix} \begin{matrix} {p_{u} = \frac{L_{u}^{\prime} - L_{m}^{\prime} + {\kappa\left( {{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}} - {3\; L_{u}^{\prime}}} \right)}}{{\sum\limits_{i \in {\{{r,g,b}\}}}L_{i}^{\prime}} - {3L_{m}^{\prime}}}} \\ {= \frac{L_{u} - {\frac{\lambda_{m}}{\lambda_{u}}L_{m}} + {\kappa\left( {{\sum\limits_{i \in {\{{r,g,b}\}}}\left( {\frac{\lambda_{i}}{\lambda_{u}}L_{i}} \right)} - {3L_{u}}} \right)}}{{\sum\limits_{i \in {\{{r,g,b}\}}}\left( {\frac{\lambda_{i}}{\lambda_{u}}L_{i}} \right)} - {\frac{3\;\lambda_{m}}{\lambda_{u}}L_{m}}}} \end{matrix} & {{Equation}\mspace{14mu}(16)} \end{matrix}$ Note that p_(m)=κ is constant, p_(u) is actually a two-band image. p_(u) is the intensity of a color band u associated with a pixel. Each shadow invariant pixel has a triplet of shadow invariant intensities (p_(r),p_(g),p_(b)). Thus, a shadow-shading invariant image can be obtained by computing p_(u) for each band of each pixel of an input image.

The relationship between p_(u) and w_(u) is summarized as follows in Theorem 3 and 4.

-   Theorem 3: For any two pixels x and y, if w_(u)(x)=w_(u)(y), then     p_(u)(x)=p_(u)(y). -   Theorem 4: For any two pixels x and y, if p_(u)(x)=p_(u)(y), then     w_(u)(x)=w_(u)(y) or w_(u)(x) is linear to w_(u)(y), that is     w_(u)(x)=Aw_(u)(y)+B, where

$A = {{\frac{1 - {3{w_{u}(x)}}}{1 - {3{w_{u}(y)}}}\mspace{14mu}{and}\mspace{14mu} B} = \frac{{w_{u}(x)} - {w_{u}(y)}}{1 - {3{w_{u}(y)}}}}$ Proofs of Theorems 3 and 4 are provided in the APPENDIX.

V. Image Recording Device Calibration

According to the shadow invariant equation P_(u) and the shadow-shading invariant equation p_(u), computation of the shadow and shadow-shading invariant image requires knowledge of the relative wavelengths of the light passing through the image sensor as follows:

$\lambda_{u}^{\prime} = \frac{\lambda_{u}}{\sum\limits_{i \in {\{{r,g,b}\}}}\lambda_{i}}$ FIG. 6A shows shadow and non-shadow pixels associated with a portion of an input image having a uniform color distribution in accordance with embodiments of the present invention. In FIG. 6A, shadow pixels are identified by shading, such as pixel 602, and non-shadow pixels are not shaded, such as pixel 604. Assuming x denotes a shadow pixel and y denotes a non-shadow pixel, according to equation (1), the relative wavelengths for the RGB bands are given by:

$\begin{matrix} {\lambda_{u}^{\prime} = \frac{1/\left( {{L_{u}(x)} - {L_{u}(y)}} \right)}{\sum\limits_{i \in {\{{r,g,b}\}}}{1/\left( {{L_{i}(x)} - {L_{i}(y)}} \right)}}} & {{Equation}\mspace{14mu}(17)} \end{matrix}$ The relative wavelength λ′_(u) is computed for each shadow and non-shadow pixel pair x and y. FIG. 6B shows an exemplary plot of red, green, and blue relative wavelength distributions represented by distribution curves 606, 608, and 610, respectively. The wavelengths λ_(r), λ_(g), and λ_(b) are associated with each peak of the distribution curves 606, 608, and 610 and serve as the calibration wavelengths for the image recording device.

Calibration of an image recording device can be performed manually. A user captures a digital image of scene and displays the image of the scene on a display device such as a monitor. The user then identifies a portion of the input image having a uniform color distribution. FIGS. 7A-7B show portions of an input image with a region having uniform color distribution that can be used to calibrate an image recording device in accordance with embodiments of the present invention. In FIG. 7A, the input image includes a region having a uniform color distribution created by three adjacent sheets of paper 701-703 disposed on a sidewalk. The input image is taken in daylight conditions so that portions of the sheets of paper also fall within a shadow of the photographer of the input image. The resulting input image shown in FIG. 7A has regions of the paper that fall within and outside the shadow of the photographer and both regions have substantially uniform color distributions. In FIG. 7B, a trapezoid-shaped region 704 identifies shadow pixels and a region 706 identifies non-shadow pixels that can be used to calibrate the image recording device using equation 16. Once the image recording device has been calibrated, no further calibration of the image recording device is performed. Input images can then be collected and shadow invariant and shadow-shading invariant images of the input images can be determined in accordance with equations (14) and (16), respectively.

VI. Shadow Invariant and Shadow-Shading Invariant Implementations

FIG. 8 shows a control-flow diagram of a method for generating a shadow invariant image from an input image in accordance with embodiments of the present invention. In optional step 801, an image recording device used to capture input images is calibrated by determining relative wavelengths λ′_(u), as described above with reference to equation 17. The relative wavelengths serve as the calibration wavelengths for the image recording device. Step 801 is performed before input images are taken and processed in accordance with steps 802-808. Once the RGB wavelengths for the image recording device are determined, step 801 does not have to be performed for subsequent input images, unless input images are taken with a different image recording device. In step 802, the input image comprises pixel data that is retrieved from memory. In the for-loop of step 803, steps 804-808 are repeated for each pixel. In the for-loop of step 804, steps 805-806 are repeated for each primary color band. In step 805, P_(u) is computed in accordance with equation (14). In step 806, repeat step 805 for a different band, otherwise proceed to step 807. In step 807, the three shadow invariant intensities P_(r), P_(g), and P_(b) associated with a pixel are displayed on a display device, such as monitor. In step 808, repeat steps 804-807 for another pixel, otherwise, proceed to step 809. In step 809, steps 802-808 are repeated for a subsequent input image.

Note that the method shown in FIG. 8 can be modified to compute the shadow-shading invariant image of the input image by modifying step 805 such that the shadow-shading invariant p_(u) is computed for each of the primary color bands and step 807 displays each of the shadow-shading invariant intensities p_(r), p_(g), and p_(b).

FIGS. 9A-9C show shadow invariant and shadow-shading invariant images obtained for the same input image in accordance with embodiments of the present invention. FIG. 9A shows the same input image used to perform image recording device calibration as described above with reference to FIG. 7A. FIG. 9B shows a shadow invariant image of the input image shown in 9A. FIG. 9B reveals that the shadow of the photographer displayed in FIG. 9A is removed from the image displayed in FIG. 9B. The shadow invariant image displayed in FIG. 9B is obtained by applying equation (14) to each pixel of the input image shown in FIG. 9A, as described above with reference to FIG. 8. Shading variations in the surface of the sidewalk on which the three sheets of paper are disposed are visible in FIG. 9B. FIG. 9C shows a shadow-shading invariant image of the input image shown in FIG. 9A. FIG. 9C reveals that the shadow of the photographer displayed in FIG. 9A and the shading in the sidewalk displayed in FIGS. 9A and 9B are removed from the shadow-shading invariant image displayed in FIG. 9C. The shadow-shading invariant image displayed in FIG. 9C is obtained by applying equation (16) to each pixel of the input image shown in FIG. 9A, as described above with reference to FIG. 6.

Note that although FIGS. 9A-9C are displayed as black and white photographs, in practice, the actual images obtained are full color images. In other words, in practice, a shadow invariant image and a shadow-shading invariant image obtained using Equations (14) and (16), respectively, are full color images.

The foregoing description, for purposes of explanation, used specific nomenclature to provide a thorough understanding of the invention. However, it will be apparent to one skilled in the art that the specific details are not required in order to practice the invention. The foregoing descriptions of specific embodiments of the present invention are presented for purposes of illustration and description. They are not intended to be exhaustive of or to limit the invention to the precise forms disclosed. Obviously, many modifications and variations are possible in view of the above teachings. The embodiments are shown and described in order to best explain the principles of the invention and its practical applications, to thereby enable others skilled in the art to best utilize the invention and various embodiments with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalents:

APPENDIX

-   Theorem 1: For any two pixels x and y, if W_(u)(x)=W_(u)(y), then     P_(u)(x)=P_(u)(y). -   Proof: Assume W_(u)(x)=W_(u)(y), then     W′ _(u)(x)=W′ _(u)(y)  Equation (18):     w _(u)(x)=w _(u)(y)  Equation (19):     Assuming L_(u)=Σ_(i∈{r,g,b})L′_(i), from equations (12), (18),     and (19) gives:

${{L_{u}^{\prime}(x)} + \frac{{{w_{m}(x)}{L_{s}^{\prime}(x)}} - {L_{m}^{\prime}(x)}}{1 - {3{w_{m}(x)}}}} = {{L_{u}^{\prime}(y)} + \frac{{{w_{m}(x)}{L_{s}^{\prime}(y)}} - {L_{m}^{\prime}(y)}}{1 - {3{w_{m}(x)}}}}$ which implies that L′ _(u)(x)−L′ _(m)(x)−L′ _(u)(y)+L′ _(m)(y)=w _(m)(x)(L′ _(s)(y)−3L′ _(u)(y)−L′ _(s)(x)+3L′ _(u)(x))  Equation (20): From (6) and (18) L′ _(u)(x)−L′ _(m)(x)−L′ _(u)(y)+L′ _(m)(y)=0  Equation (21): For chromatic pixels, w_(m)(x)≠0, thus substitutes (21) and (20), we have L′ _(s)(y)−3L′ _(u)(y)−L′ _(s)(x)+3L′ _(u)(x)=0  Equation (22): From equations (21) and (22):

((L_(u)^(′)(x) − L_(m)^(′)(x)) − (L_(u)^(′)(y) + L_(m)^(′)(y))) = κ(L_(s)^(′)(y) − 3L_(u)^(′)(y) − L_(s)^(′)(x) + 3L_(u)^(′)(x)) ${{L_{u}^{\prime}(x)} + \frac{{\kappa\;{L_{s}^{\prime}(x)}} - {L_{m}^{\prime}(x)}}{1 - {3\kappa}}} = {{L_{u}^{\prime}(y)} + \frac{{\kappa\;{L_{s}^{\prime}(y)}} - {L_{m}^{\prime}(y)}}{1 - {3\kappa}}}$ ${{L_{u}(x)} + {\frac{hc}{\lambda_{u}k}\frac{{\kappa\;{L_{s}^{\prime}(x)}} - {L_{m}^{\prime}(x)}}{1 - {3\kappa}}}} = {{L_{u}(y)} + {\frac{hc}{\lambda_{u}k}\frac{{\kappa\;{L_{s}^{\prime}(y)}} - {L_{m}^{\prime}(y)}}{1 - {3\kappa}}}}$ Thus, P _(u)(x)=P _(u)(y)  Equation (23):

-   Theorem 2: For any two pixels x and y, if P_(u)(x)=P_(u)(y), then     W_(u)(x)=W_(u)(y) or the color difference of W_(u)(x) and W_(u)(y)     is neutral. In other words,

$\frac{{W_{u}(x)} - {W_{u}(y)}}{\sum\limits_{i \in {\{{r,g,b}\}}}\left( {{W_{i}(x)} - {W_{i}(y)}} \right)} = \frac{1}{3}$

-   Proof: Assume P_(u)(x)=P_(u)(y), from equation (14):     (1−3κ)L′ _(u)(x)+κL′ _(s)(x)−L′ _(m)(x)=(1−3κ)L′ _(u)(y)+κL′     _(s)(y)−L′ _(m)(y)     L′ _(u)(x)−L′ _(m)(x)−L′ _(u)(y)+L′ _(m)(y)=κ(L′ _(s)(y)−L′     _(s)(x))+3κ(L′ _(u)(x)−L′ _(u)(y))  Equation (24):     Substitute equation (6) into equation (24), and assume     W′_(s)=Σ_(i∈{r,g,b})W′_(i), we have     (W′ _(u)(x)−W′ _(u)(y))−(W′ _(u)(x)−W′ _(m)(y))=κ(W′ _(s)(y)−W′     _(s)(x))+3κ(W′ _(u)(x)−W′ _(u)(y))  Equation (25):     Sum up every channel u∈{r,g,b} in equation (25):     (W′ _(s)(x)−W′ _(s)(y))−3(W′ _(m)(x)−W′ _(m)(y))=0     Implying     (W _(s)(x)−W_(s)(y))−3(W _(m)(x)−W_(m)(y))=0     Thus W_(m)(x)−W_(m)(y)=0 or

$\frac{{W_{m}(x)} - {W_{m}(y)}}{{W_{s}(x)} - {W_{s}(y)}} = \frac{1}{3}$ where m can be any band.

-   Theorem 3: For any two pixels x and y, if w_(u)(x)=w_(u)(y), then     p_(u)(x)=p_(u)(y). -   Proof: From equations (16) and (6) gives:

$\begin{matrix} {p_{u} = \frac{w_{u} - w_{m} + {\kappa\left( {1 - {3w_{u}}} \right)}}{1 - {3w_{m}}}} & {{Equation}\mspace{14mu}(26)} \end{matrix}$ Thus if w_(u)(x)=w_(u)(y) then p_(u)(x)=p_(u)(y).

-   Theorem 4: For any two pixels x and y, if p_(u)(x)=p_(u)(y), then     w_(u)(x)=w_(u)(y) or w_(u)(x) is linear to w_(u)(y), that is     w_(u)(x)=Aw_(u)(y)+B, where

$A = {{\frac{1 - {3{w_{u}(x)}}}{1 - {3{w_{u}(y)}}}\mspace{14mu}{and}\mspace{14mu} B} = \frac{{w_{u}(x)} - {w_{u}(y)}}{1 - {3{w_{u}(y)}}}}$

-   Proof: Assume p_(u)(x)=p_(u)(y), from equation (26):

$\begin{matrix} {{\frac{{w_{u}(x)} - {w_{m}(x)} + {\kappa\left( {1 - {3{w_{u}(x)}}} \right)}}{1 - {3{w_{m}(x)}}} = \frac{{w_{u}(y)} - {w_{m}(y)} + {\kappa\left( {1 - {3{w_{u}(y)}}} \right)}}{1 - {3{w_{m}(y)}}}}{{{w_{u}(x)} - {w_{m}(x)} - {3\;\kappa\;{w_{u}(x)}} - {3{w_{u}(y)}\left( {{w_{u}(x)} + \kappa - {3{{kw}_{u}(x)}}} \right)}} = {{w_{u}(y)} - {w_{m}(x)} - {3\kappa\;{w_{u}(y)}} - {3{w_{u}(x)}\left( {{w_{u}(y)} + \kappa - {3{{kw}_{u}(y)}}} \right)}}}{{{\left( {1 - {3\kappa}} \right)\left( {{w_{u}(x)} - {w_{u}(y)}} \right)} - {\left( {1 - {3\kappa}} \right)\left( {{w_{m}(x)} - {w_{m}(y)}} \right)} - {3\left( {1 - {3\kappa}} \right)\left( {{{w_{m}(y)}{w_{u}(x)}} - {{w_{m}(x)}{w_{u}(y)}}} \right)}} = 0}} & {{Equation}\mspace{14mu}(27)} \end{matrix}$ Using κ≠⅓, from equation (27) gives: (w _(u)(x)−w _(u)(y))−(w _(m)(x)−w _(m)(y))−3(w _(m)(y)w _(u)(x)−w _(m)(x)w _(u)(y))=0 For chromaticity pixels, w≠⅓. Thus, w_(u)(x)=Aw_(u)(y)+B, where

$A = {{\frac{1 - {3{w_{u}(x)}}}{1 - {3{w_{u}(y)}}}\mspace{14mu}{and}\mspace{14mu} B} = \frac{{w_{u}(x)} - {w_{u}(y)}}{1 - {3{w_{u}(y)}}}}$ 

1. A method performed by a computing device for determining a shadow invariant image from input image data, the method comprising: receiving input image data associated with an image of a scene from an image recording device, each pixel of the input image data including pixel intensities associated with three or more primary colors; calculating a shadow invariant intensity for each pixel intensity of each pixel; and displaying a color shadow invariant image of the scene by displaying the shadow invariant intensities of each pixel on a display device.
 2. The method of claim 1 wherein receiving input image data further comprises uploading data from the image recording device to the computing device.
 3. The method of claim 1 wherein calculating the shadow invariant intensity for each pixel intensity further comprises computing: $P_{u} = {L_{u} + \frac{{\kappa{\sum\limits_{i \in {\{{r,g,b}\}}}{\frac{\lambda_{i}}{\lambda_{u}}L_{i}}}} - {\frac{\lambda_{m}}{\lambda_{u}}L_{m}}}{1 - {3\kappa}}}$ where L_(u) is the logarithm of the pixel intensity I_(u); κ is a constant other than ⅓; and λ_(u) is a wavelength of the primary color u.
 4. The method of claim 3 wherein calculating the shadow invariant intensity for each pixel intensity further comprises computing: $L_{u} = {{\log\left( I_{u} \right)} = {{\log\left\lbrack {\left( {{\rho_{d}{S\left( \lambda_{u} \right)}} + \rho_{s}} \right)q_{u}\frac{2{hc}^{2}}{\lambda_{u}^{5}}} \right\rbrack} + \left( {- \frac{hc}{\lambda_{u}{kT}}} \right)}}$ where I_(u) is a pixel intensity associated with primary color u; h is Plank's constant; c is the speed of light in a vacuum; k is Boltzmann's constant; T is the color temperature ρ_(d) and ρ_(s) are geometric factors associated with diffuse and specular reflection of each pixel; q_(u) is the magnitude of the sensor response associated with the pixel; and S(λ) is a surface reflectance spectrum.
 5. The method of claim 1 further comprises calibrating the image recording device.
 6. The method of claim 5 wherein calibrating the image recording device further comprises calculating the relative wavelength $\lambda_{u}^{\prime} = \frac{1/\left( {{L_{u}(x)} - {L_{u}(y)}} \right)}{\sum\limits_{i \in {\{{r,g,b}\}}}{1/\left( {{L_{i}(x)} - {L_{i}(y)}} \right)}}$ for each shadow and non-shadow pixel pair x and y, respectively, within a uniform color distribution.
 7. The method of claim 1 wherein the image recording device further comprises a digital camera, a mobile phone, a camera phone, a personal digital assistant, a camcorder or any device that digitally captures images via an electronic image sensor and can store the image data in memory.
 8. The method of claim 1 wherein the computing device further comprises a desktop computer, a laptop computer, a portable computer, a display system, a television, a computer monitor, a navigation system, a portable media player, a personal digital assistant, a game console, a handheld electronic device, an embedded electronic device, or an appliance.
 9. The method of claim 1 wherein calculating the shadow invariant image further comprises assuming Plankian illuminating conditions.
 10. A method performed by a computing device for determining a shadow-shading invariant image from input image data, the method comprising: receiving input image data associated with an image of a scene from a image recording device, each pixel of the input image data including pixel intensities associated with three or more primary colors; calculating a shadow-shading invariant intensity for each pixel intensity of each pixel; and displaying a color shadow-shading invariant image of the scene by displaying the shadow-shading invariant intensities of each pixel on a display device.
 11. The method of claim 10 wherein receiving input image data further comprises uploading data from the image recording device to the computing device.
 12. The method of claim 10 wherein calculating the shadow-shading invariant intensity for each pixel intensity further comprises calculating: $p_{u} = \frac{L_{u} - {\frac{\lambda_{m}}{\lambda_{u}}L_{m}} + {\kappa\left( {{\sum\limits_{i \in {\{{r,g,b}\}}}\left( {\frac{\lambda_{i}}{\lambda_{u}}L_{i}} \right)} - {3\; L_{u}}} \right)}}{{\sum\limits_{i \in {\{{r,g,b}\}}}\left( {\frac{\lambda_{i}}{\lambda_{u}}L_{i}} \right)} - {\frac{3\lambda_{m}}{\lambda_{u}}L_{m}}}$ where L_(u) is the logarithm of the pixel intensity I_(u); κ is a constant other than ⅓; and λ_(u) is a wavelength of the primary color u.
 13. The method of claim 12 wherein calculating the shadow-shading invariant intensity for each pixel intensity further comprises calculating: $L_{u} = {{\log\left( I_{u} \right)} = {{\log\left\lbrack {\left( {{\rho_{d}{S\left( \lambda_{u} \right)}} + \rho_{s}} \right)q_{u}\frac{2{hc}^{2}}{\lambda_{u}^{2}}} \right\rbrack} + \left( {- \frac{hc}{\lambda_{u}{kT}}} \right)}}$ where I_(u) is a pixel intensity associated with primary color u; h is Plank's constant; c is the speed of light in a vacuum; k is Boltzmann's constant; T is the color temperature ρ_(d) and ρ_(s) are geometric factors associated with diffuse and specular reflection of each pixel; q_(u) is the magnitude of the sensor response associated with the pixel; and S(λ) is a surface reflectance spectrum.
 14. The method of claim 10 further comprises calibrating the image recording device.
 15. The method of claim 14 wherein calibrating the image recording device further comprises calculating the relative wavelength $\lambda_{u}^{\prime} = \frac{1/\left( {{L_{u}(x)} - {L_{u}(y)}} \right)}{\sum\limits_{i \in {\{{r,g,b}\}}}{1/\left( {{L_{i}(x)} - {L_{i}(y)}} \right)}}$ for each shadow and non-shadow pixel pair x and y, respectively, within a uniform color distribution.
 16. The method of claim 10 wherein the image recording device further comprises a digital camera, a mobile phone, a camera phone, a personal digital assistant, a camcorder or any device that digitally captures images via an electronic image sensor and can store the image data in memory.
 17. The method of claim 10 wherein the computing device further comprises a desktop computer, a laptop computer, a portable computer, a display system, a television, a computer monitor, a navigation system, a portable media player, a personal digital assistant, a game console, a handheld electronic device, an embedded electronic device, or an appliance.
 18. The method of claim 10 wherein calculating the shadow-shading invariant image further comprises assuming Plankian illuminating conditions. 